import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderMainVO, OrderMainForm, OrderMainQuery } from '@/api/demo/orderMain/types';

/**
 * 查询测试订单主表列表
 * @param query
 * @returns {*}
 */

export const listOrderMain = (query?: OrderMainQuery): AxiosPromise<OrderMainVO[]> => {
  return request({
    url: '/demo/orderMain/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询测试订单主表详细
 * @param id
 */
export const getOrderMain = (id: string | number): AxiosPromise<OrderMainForm> => {
  return request({
    url: '/demo/orderMain/' + id,
    method: 'get'
  });
};

/**
 * 新增测试订单主表
 * @param data
 */
export const addOrderMain = (data: OrderMainForm) => {
  return request({
    url: '/demo/orderMain',
    method: 'post',
    data: data
  });
};

/**
 * 修改测试订单主表
 * @param data
 */
export const updateOrderMain = (data: OrderMainForm) => {
  return request({
    url: '/demo/orderMain',
    method: 'put',
    data: data
  });
};

/**
 * 删除测试订单主表
 * @param id
 */
export const delOrderMain = (id: string | number | Array<string | number>) => {
  return request({
    url: '/demo/orderMain/' + id,
    method: 'delete'
  });
};
